//
//  PickupModel.m
//  ProjectforHDX
//
//  Created by yinda on 2018/6/7.
//  Copyright © 2018年 H.DX. All rights reserved.
//

#import "PickupModel.h"

@implementation PickupModel
-(void)encodeWithCoder:(NSCoder *)aCoder{
    
    NSArray *names = [NSArray gethdxProperties:[self class]];
    for (NSString *name in names) {
        id value = [self valueForKey:name];
        
        [aCoder encodeObject:value  forKey:name];
    }
    
}

-(id)initWithCoder:(NSCoder *)aDecoder{
    self = [super init];
    if (self) {
        //获取所有属性 ，遍历 给属性赋值
        NSArray *names = [NSArray gethdxProperties:[self class]];
        for (NSString *name in names) {
            [self  setValue:[aDecoder decodeObjectForKey:name] forKey:name];
            
        }
        
    }
    return self;
}

-(void)setAttributes:(NSDictionary *)userInfo{
    
    [super setAttributes:userInfo];
    
    //获取所有属性 ，遍历 给属性赋值
    NSArray *names = [NSArray gethdxProperties:[self class]];
    for (NSString *name in names) {
        [self  setValue:[userInfo objectForKey:name] forKey:name];
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"id"]) {
        self.partID = value;
    }
}

@end
